//
//  ShopOrdersViewCell.swift
//  iModern
//
//  Created by 张义帅 on 15/8/25.
//  Copyright (c) 2015年 com.starlooking. All rights reserved.
//

import UIKit

class ShopOrdersViewCell: TableViewCell
{

    @IBOutlet weak var shopLogoUrl: UIImageView!

    @IBOutlet weak var shopName: UILabel!

    @IBOutlet weak var address: UILabel!

    @IBOutlet weak var message: UILabel!

    @IBOutlet weak var summary: UILabel!

    @IBOutlet weak var quantity: UILabel!

    @IBOutlet weak var price: UILabel!

    @IBOutlet weak var score: UILabel!
    
    let __1avatar_image_view_tags = 111

    override func awakeFromNib()
    {
        super.awakeFromNib()
        
    }

    override func setSelected(selected: Bool, animated: Bool)
    {
        super.setSelected(selected, animated: animated)

    }

    func setData(data: NSMutableDictionary)
    {
        //var assignedTo = data["assignedTo"] as! NSDictionary
        let contact = data["contact"] as! NSDictionary
        //let advertisings = data["advertising"] as! NSDictionary
        
        let shopName = contact["alias"] as? String
        self.shopName.text=shopName
        
        let thumbnailURL = contact["thumbnailURL"] as? String

        if thumbnailURL == nil
        {
            self.shopLogoUrl.image=UIImage(named: "Avatar-Default.png")
        }
        else
        {
            self.shopLogoUrl.load(appDelegate.parameterManager.server + "/" + thumbnailURL!, placeholder: nil)
            
        }
        
        let address = data["address"] as? String
        self.address.text=address
        
        let message = data["message"] as? String
        self.message.text=message
        
        let advertising = data["advertising"] as! NSDictionary
        let summary = advertising["summary"] as? String
        self.summary.text=summary
        
        let quantity = data["quantity"] as! Int
        let strVar1 : String = String(stringInterpolationSegment: quantity)
        self.quantity.text=strVar1
        
        let price = advertising["price"] as! Double
        let strVar2 : String = String(stringInterpolationSegment: price)
        self.price.text=strVar2
        
        let score = data["score"] as! Int
        
        if score == -1
        {
            self.score.text="未评价"
        }
        else
        {
            self.score.text="已评价"
        }
        self.score.textColor = Theme.theme_color
        
    }

}
